<template>
  <div class="form">
    <elForm ref="formRef" :formData="formData" :formItems="formItems"/>
    <el-button type="primary" @click="submitForm">Primary</el-button>
    <el-button type="info" @click="resetForm">Info</el-button>
  </div>
</template>

<script setup lang="ts">
import elForm from '@/components/vx-form/index.vue'
import formItems from './data/data'

const formRef = ref()
let formData = reactive({})
const submitForm = ()=>{
  formRef.value.submitForm({
    url:'/api/table_test/insert',
    method:'post',
    data:formData
  })
}
const resetForm = ()=>{
  formRef.value.resetForm()
}
</script>

<style scoped lang="scss">
.form{
  width: 98%;
  height: calc(100vh - 200px);
  background-color: #fff;
  border-radius: 4px;
  padding: 10px;
}
</style>
